# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=double-conversion
pkgver=3.3.0
pkgrel=0
pkgdesc="Binary-decimal and decimal-binary routines for IEEE doubles"
url="https://github.com/google/double-conversion"
arch="all"
license="BSD-3-Clause"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/double-conversion/archive/v$pkgver.tar.gz"

case "$CARCH" in
x86) options="$options !check" ;; # SIGABRT in tests
esac

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto" \
	CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \
	cmake -B build -G Ninja \
		-DBUILD_TESTING=ON \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON
	cmake --build build
}

check() {
	cd build
	test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
51e84eb7a5c407f7bc8f8b8ca19932ece5c9d8ac18aedff7b7620fc67369d9b2aa8c5a6b133e7f8633d7cc5e3788bad6e60b0e48ac08d0a4bc5e4abe7cee1334  double-conversion-3.3.0.tar.gz
"
